<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/10/28
 * Time: 8:53
 */
namespace app\team\model;

use think\Model;
use think\Request;
use think\Db;
use think\Session;
class Comment extends Model
{
    static function getAppList($where, $offset, $limit)
    {
        $res = Db::name('appraise')->alias('a')
            ->field('a.*,u.nickname,g.gtour_title')
            ->join('user u','a.user_id=u.uid','left')
            ->join('group_tour g','a.item_id=g.id','left')
            ->where($where)
            ->limit($offset, $limit)->order('a.app_id','desc')->select();
        foreach($res as $k=>$v){
            $res[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
        }
        return $res;
    }

    //总数
    static function getAppraiseCount($where)
    {
        return  Db::name('appraise')->alias('a')
            ->field('a.*,u.nickname')
            ->join('user u','a.user_id=u.uid','left')->where($where)->count();
    }
}